<template>
	<view class="banner">
		<swiper class="banner__swiper" autoplay="true" indicator-dots="true" indicator-active-color="#fff" style="width: 100%; height: 100%;">
			<swiper-item v-for="item in bannerList" :key="item.id" @click="linkTo(item.jumpId,item.learnType)">
				<image class="banner__slide-image" :src="item.picUrl" style="width:100%;height:100%;border-radius: 8upx;"></image>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	import {
		isEmpty
	} from '@/utils/index';
	export default {
		props: {
			bannerList: {
				type: Array,
				default: function() {
					return [];
				}
			}
		},
		data() {
			return {};
		},
		computed: {},
		watch: {},
		methods: {
			linkTo(id, type) {
				//进入其他任务页面
				if (isEmpty(id)) return;
				uni.navigateTo({
					url: "/pages/tabbar/study/details/index?id=" + id + "&type=" + type
				});
			}
		}
	};
</script>

<style lang="less" scoped>
	.banner {
		width: 100%;
		height: 320upx;
		padding: 40upx 30upx 0;
		border-radius: 16upx;
		background-color: #fff;
	}
</style>
